from simpletcp.clientsocket import ClientSocket

s1 = ClientSocket("192.168.2.4", 5000)
json = '''{
    "Username":"ztz1",
    "Operation": "Exit",
    "Index": 1,
    "Record": {
        "RoundIndex": 1,
        "StarNumber": 3,
        "Time": 1,
        "Step": 1
    }
}'''
response = s1.send(json)

# s2 = ClientSocket("localhost", 5000, single_use=False)
# r1 = s2.send("Hello for the first time...")
# r2 = s2.send("...and hello for the last!")
# s2.close()

# Display the correspondence
print("s1 sent\t\t{}".format(json))
print("s1 received\t\t{}".format(response.decode("UTF-8")))
# print("-------------------------------------------------")
# print("s2 sent\t\tHello for the first time....")
# print("s2 received\t\t{}".format(r1.decode("UTF-8")))
# print("s2 sent\t\t...and hello for the last!.")
# print("s2 received\t\t{}".format(r2.decode("UTF-8")))
